From 7c8905fa12a3c78b4475e69bc6d7b3541931d3a5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 8 Sep 2004 07:35:00 +0000 Subject: [PATCH] Add $wgUserLanguages array to specify which languages users are allowed to select for the user interface. If this is left at the default empty array the selection is disabled. Currently the language selection is broken and will fail for many cases, using bogus namespaces and probably corrupting your database with bogus links, search index updates, and more. --- includes/DefaultSettings.php | 9 +++++++++ includes/Setup.php | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 93b9728b1e..133ab5598e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -248,6 +248,15 @@ $wgUseTurckShm = false; */ $wgLanguageCode = 'en'; +/** + * Languages which the user may select to display the user interface + * in instead of the default language. This option is currently + * experimental and WILL FAIL FOR MANY COMMON TASKS AND PERHAPS + * CORRUPT YOUR DATABASE WITH BOGUS DATA. + * Set to eg array( 'en', 'fr', 'zh' ) etc + */ +$wgUserLanguages = array(); + /** * Filename of a language file generated by dumpMessages.php * @global string|false $wgLanguageFile (default:false) diff --git a/includes/Setup.php b/includes/Setup.php index c48aa8ed9a..ba9daef87c 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -217,12 +217,17 @@ if( $wgCommandLineMode ) { } // FIXME : we don't know what the user entered (see SpecialPreferences.php [AV]) -if(isset($wgUser->mOptions['language'])) { +if( count( $wgUserLanguages ) && + !empty( $wgUser->mOptions['language'] ) && + in_array( $wgUser->mOptions['language'], $wgUserLanguages ) ) { // Change language of the site $wgLanguageCode = $wgUser->mOptions['language']; // we will load messages from file instead of from database $wgUseDatabaseMessages = false; - } + # FIXME: THIS WILL BREAK NAMESPACES, VARIABLES, + # SEARCH INDEX UPDATES, AND MANY MANY THINGS. + # DO NOT USE THIS MODE EXCEPT FOR TESTING RIGHT NOW. +} wfProfileOut( $fname.'-User' ); wfProfileIn( $fname.'-language' ); -- 2.20.1